var http = require('http')
var app = require('express')()
var httpServer = http.createServer(app)
app.all('*', function(req, res, next) {
	res.header('Access-Control-Allow-Origin', '*')
	res.header(
		'Access-Control-Allow-Headers',
		'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild'
	)
	res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS')

	if (req.method == 'OPTIONS') {
		res.send(200)
	} else {
		next()
	}
})
var home = require('./home/index')
home.init(app)
httpServer.listen(3000, function() {
	console.log('HTTP Server is running on: http://localhost:%s', 3000)
})
